import { gql } from '@apollo/client';

// 查询
export const GET_COURSES = gql`
query getCourses($page:PageInput!,$name: String) {
  getCourses(page:$page,name: $name){
    code
    message
    data {
      id
      name   
      limitNumber
      duration
    }
    page {
      pageNum
      pageSize
      total
    }
  }
}
`;
// 详情
export const GET_COURSE_INFO = gql`
query getCourseInfo($id:String!) {
  getCourseInfo(id:$id){
    code
    message
    data {
      id
      name
      desc
      group
      coverUrl
      baseAbility
      limitNumber
      duration
      reserveInfo
      refundInfo
      otherInfo
      teachers {
        id
        name
        photoUrl
      }
      reducibleTime {
          week
          orderTime {
            startTime
            endTime
            key
          }
      }
    }
  }
}
`;
// 删除
export const DELETE_COURSE = gql`
    mutation deleteCourse($id:String!) {
        deleteCourse(id:$id){
            code,
            message,
        }
    }
`;

// 增/改
export const COMMIT_COURSE = gql`
    mutation commitCourseInfo($params:  PartialCourseInput!,$id:String) {
      commitCourseInfo(params: $params,id:$id){
          code,
          message,
      }
    }
`;
